package com.heima.comment.controller;

import com.heima.comment.service.ICommentRepayService;
import com.heima.model.comment.dtos.*;
import com.heima.model.common.dtos.ResponseResult;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

@RestController
@Slf4j
@RequiredArgsConstructor
@RequestMapping("/api/v1/comment_repay")
public class CommentRepayController {

    private final ICommentRepayService commentRepayService;

    /** 查看评论回复列表 */
    @PostMapping("/load")
    public ResponseResult loadCommentRepay(@RequestBody CommentRepayLoadDTO dto){
        log.info("用户进行了查看评论回复：{}",dto);
        return commentRepayService.load(dto);
    }

    /** 进行回复评论 */
    @PostMapping("/save")
    public ResponseResult saveCommentRepay(@RequestBody CommentRepaySaveDTO dto ){
        log.info("进行了回复评论:{]",dto);
        return  commentRepayService.save(dto);
    }

    /** 用户进行了点赞 */
    @PostMapping("/like")
    public ResponseResult likeComment(@RequestBody CommentRepayLikeDTO dto){
        log.info("用户进行了点赞:{}",dto);
        return commentRepayService.like(dto);
    }
}
